<template>
  <main class="main-container">
    <h1>通知公告内容</h1>
    <el-input
      v-model="value"
      type="textarea"
      rows="20"
      placeholder="请输入内容"
      maxlength="500"
      show-word-limit
    ></el-input>
    <div style="display: flex; justify-content: flex-end">
      <el-button
        style="margin-top: 20px"
        size="large"
        type="primary"
        @click="submit"
        >发布</el-button
      >
    </div>
  </main>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { getNotice, addNotice } from "@/api/notice";
import { ElMessage } from "element-plus";
const value = ref("");
const getData = async () => {
  let content = await getNotice();
  value.value = content.content;
};
const submit = async () => {
  await addNotice(value.value);
  ElMessage.success("发布成功");
};
getData();
</script>
<style scoped lang="less"></style>
